<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - InPlaceEdit Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset-fonts/reset-fonts.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

 <body>

<h1>inputEx - InPlaceEdit Usage</h1>


<!-- Example 1 -->
<div class='exampleDiv'>
	<h2>Basic InPlaceEdit creation</h2>
	<p>Use the following code to create a basic inputEx InPlaceEdit.</p>
	<div class='demoContainer' id='container1'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			new inputEx.InPlaceEdit({parentEl: 'container1', editorField:{type:'string'}, animColors:{from:"#FFFF99" , to:"#DDDDFF"} });
		</textarea>
	</div>
</div>


<!-- Example 2 -->
<div class='exampleDiv'>
	<h2>Complex group example</h2>
	<p>Combine InPlaceEdit and groups</p>
	<div class='demoContainer' id='container2'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			new inputEx.InPlaceEdit({
				parentEl: 'container2', 
				editorField:{
					type:'group', 
					fields: [
						{ label: 'Firstname',name: 'firstname' },
						{ label: 'Lastname', name: 'lastname' },
						{ type:'url', label: 'Photo', name:'picUrl', favicon: false }
					]
				},
				visu: {visuType: 'func', func: function(val) {
					if( YAHOO.lang.isUndefined(val) ) return inputEx.messages.emptyInPlaceEdit;
					return '<img src="'+val.picUrl+'" style="width: 128px; height: 128px;" /><br /><b>'+val.firstname+' '+val.lastname+'</b>';
				}},
				value: {
						firstname: 'Lena',
						lastname: 'Idontknow',
						picUrl: 'http://www.limsi.fr/Individu/vezien/lena.jpg'
				}
			});
		</textarea>
	</div>
</div>



<!-- Example 3 -->
<div class='exampleDiv'>
	<h2>Getting the value</h2>
	<p>When the editor is opened, getValue return the editor value.</p>
	<div class='demoContainer' id='container3'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			var field = new inputEx.InPlaceEdit({parentEl: 'container3', editorField:{type:'string'} });
			var button = inputEx.cn('button', null, null, "getValue");
			YAHOO.util.Event.addListener(button, 'click', function() {
				alert(field.getValue());
			});
			YAHOO.util.Dom.get('container3').appendChild(button);
		</textarea>
	</div>
</div>




<!-- Example 4 -->
<div class='exampleDiv'>
	<h2>Image url from a dropdown menu</h2>
	<p></p>
	<div class='demoContainer' id='container4'></div>
	<div class='codeContainer'>
		<textarea name="code" class="JScript">
			inputEx({
				type: 'inplaceedit',
				parentEl: 'container4', 
				label: "PageRank",
				editorField:{
					type:'select', 
					name: 'pagerank',
					choices: ['0','1','2','3','4','5','6','7','8','9','10']
				},
				visu: {
					visuType: 'func', 
					func: function(val) {
						return inputEx.cn('img',{src: "http://www.page-rank-lookup.com/i/style1/pagerank"+val+".png"});
					}
				},
				value: '5'
			});
		</textarea>
	</div>
</div>



<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/mixins/choice.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/Group.js"  type='text/javascript'></script>
<script src="../js/Visus.js"  type='text/javascript'></script>
<script src="../js/fields/StringField.js"  type='text/javascript'></script>
<script src="../js/fields/SelectField.js"  type='text/javascript'></script>
<script src="../js/fields/EmailField.js"  type='text/javascript'></script>
<script src="../js/fields/UrlField.js"  type='text/javascript'></script>
<script src="../js/fields/ListField.js"  type='text/javascript'></script>

<script src="../js/widgets/Button.js"  type='text/javascript'></script>
<script src="../js/fields/InPlaceEdit.js"  type='text/javascript'></script>


<script src="../js/fields/UrlField.js"  type='text/javascript'></script>

<!-- inputEx examples -->
<script src="js/dpSyntaxHighlighter.js"></script>
<script src="inputex-examples.js"></script>

 </body>
</html>